


set(PRODUCT_SOURCES_FILES)


#----- грузим настройки юнит-тестов
if(UNIT_TEST_MODE AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/unit_test/CMakeLists.txt )
    
    add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/unit_test )    

    include_directories( ${EXTERNAL_LIB_HEADERS_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/unit_test/include )
    link_directories   ( ${EXTERNAL_LIB_NAMES_PATH}   )

    group_files( "${CMAKE_CURRENT_SOURCE_DIR}/unit_test/include" PRODUCT_SOURCES_FILES)
    group_files( "${CMAKE_CURRENT_SOURCE_DIR}/unit_test/src"     PRODUCT_SOURCES_FILES)
    add_executable( unit_test_${PROJECT_NAME} ${PRODUCT_SOURCES_FILES} )

    add_dependencies( unit_test_${PROJECT_NAME} ${PROJECT_NAME} )

    #------------------------ устанавливаем имя pdb файла собранной цели ---------------------------------
    if(MSVC)
	set(file_pdb ${CMAKE_BUILD_TYPE}/unit_test_${PROJECT_NAME}.pdb )
	set_target_properties(  unit_test_${PROJECT_NAME}
	    PROPERTIES
	    COMPILE_FLAGS "/Fd\"${file_pdb}\"")
    endif()

    #----------------------- линкуем проект со всеми внешними библиотеками -------------------------------

    if(EXTERNAL_LIB_NAMES)
        target_link_libraries( unit_test_${PROJECT_NAME} ${EXTERNAL_LIB_NAMES} ${PROJECT_NAME})
        target_link_libraries( unit_test_${PROJECT_NAME} ${EXTERNAL_LIB_NAMES} ${PROJECT_NAME})
    endif()

else()
    message(STATUS "unit-test disabled")
endif()




